Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example/example re assembling fields #1726

Merged
merged 16 commits into from
Oct 22, 2024

Conversation

luisaFelixSalles
Copy link
Collaborator

This new example shows how to do some matrix operations, including basic mathematical operation (power, add and multiply by
a constant, add field containers and invert ) and separating and assembling fields and fields containers

@luisaFelixSalles luisaFelixSalles added the examples Related to PyDPF-Core examples label Sep 3, 2024
@luisaFelixSalles luisaFelixSalles self-assigned this Sep 3, 2024
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.10%. Comparing base (f3463cb) to head (e64a31c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1726   +/-   ##
=======================================
  Coverage   88.10%   88.10%           
=======================================
  Files          83       83           
  Lines        9951     9951           
=======================================
  Hits         8767     8767           
  Misses       1184     1184           

@rafacanton
Copy link
Contributor

@luisaFelixSalles Thanks for the example. I think it would be good to have a follow-up on this one to explain users how to create their own matrix fields "by hand". Dpf Matrix Fields are created "by column" and not "by row", and we are not documenting it anywhere. This also affects the way the generalized_dot_product operator is working.

@PProfizi This caused a bug in the past, so I think it is something we would like to properly document. In addition, it works differently in numpy, so it is not very straigthforward to use without an example

@PProfizi
Copy link
Contributor

PProfizi commented Sep 4, 2024

@luisaFelixSalles Thanks for the example. I think it would be good to have a follow-up on this one to explain users how to create their own matrix fields "by hand". Dpf Matrix Fields are created "by column" and not "by row", and we are not documenting it anywhere. This also affects the way the generalized_dot_product operator is working.

@PProfizi This caused a bug in the past, so I think it is something we would like to properly document. In addition, it works differently in numpy, so it is not very straigthforward to use without an example

@luisaFelixSalles I think this remark could go both in a specific tutorial on Field creation, and in the User Guide documentation.

Copy link
Contributor

@PProfizi PProfizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice example, just a few things to change

examples/01-mathematical-operations/matrix-operations.py Outdated Show resolved Hide resolved
examples/01-mathematical-operations/matrix-operations.py Outdated Show resolved Hide resolved
import ansys.dpf.core.operators.math as maths

###############################################################################
# Open an example and print the ``Model`` object. Here a result file from a crankshaft
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Open an example and print the ``Model`` object. Here a result file from a crankshaft
# Load an example and print the ``Model`` object. Here a result file from a crankshaft

#
my_model = dpf.Model(examples.find_complex_rst())
my_mesh = my_model.metadata.meshed_region
# print(my_model)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment the print?

examples/01-mathematical-operations/matrix-operations.py Outdated Show resolved Hide resolved
examples/01-mathematical-operations/matrix-operations.py Outdated Show resolved Hide resolved
examples/01-mathematical-operations/matrix-operations.py Outdated Show resolved Hide resolved
examples/01-mathematical-operations/matrix-operations.py Outdated Show resolved Hide resolved
Comment on lines 88 to 90
# There are different methods to re-assemble the components

# 1) With the class :class:'assemble_scalars_to_matrices_fc <ansys.dpf.core.operators.utility.assemble_scalars_to_matrices_fc.assemble_scalars_to_matrices_fc>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now there is only one

examples/01-mathematical-operations/matrix-operations.py Outdated Show resolved Hide resolved
@luisaFelixSalles luisaFelixSalles mentioned this pull request Sep 6, 2024
3 tasks
Co-authored-by: Paul Profizi <100710998+PProfizi@users.noreply.github.com>
Co-authored-by: Paul Profizi <100710998+PProfizi@users.noreply.github.com>
luisaFelixSalles and others added 2 commits September 26, 2024 09:20
Co-authored-by: Paul Profizi <100710998+PProfizi@users.noreply.github.com>
@luisaFelixSalles luisaFelixSalles force-pushed the example/example-re-assembling-fields branch from f276ba3 to 354b8ca Compare October 21, 2024 13:51
@luisaFelixSalles luisaFelixSalles force-pushed the example/example-re-assembling-fields branch from 95f9404 to 354b8ca Compare October 21, 2024 14:32
@luisaFelixSalles luisaFelixSalles merged commit 5132ec5 into master Oct 22, 2024
44 checks passed
@luisaFelixSalles luisaFelixSalles deleted the example/example-re-assembling-fields branch October 22, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Related to PyDPF-Core examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants